#include <pthread.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <sys/time.h>

class base
{
public:
	base ()
	{
	}
	virtual void print () = 0;
	virtual ~base ()
	{
		printf ("destruct base\n");
		sleep (1000);
	}
};
class test : public base
{
public:
	test ()
	{
	}
	void print ()
	{
		printf ("print function\n");
	}
	~test ()
	{
		printf ("destruct test\n");
	}
};
base *b = 0;
void *func (void *)
{
	sleep (1);
	printf ("in\n");
	b->print ();
	printf ("out\n");
	return 0;
}

int main ()
{
	b = new test ();
	pthread_t pid;
	pthread_create (&pid, 0, &func, 0);
	delete b;
	sleep (10000);
}
